import { _decorator, Component, Label, Node } from 'cc';
import { AE } from '../../core/ae/AE';
const { ccclass, property } = _decorator;

@ccclass('PopTips')
export class PopTips extends Component {

    protected onLoad(): void {
        AE.playGeneralEffect('ToastIn', {
            offsetY: 100,
            node: this.node,
            callback: () => {
                this.scheduleOnce(() => {
                    this.close();
                }, 1)
            }
        })
    }



    /**显示 */
    public show(str: string) {
        this.node.getChildByName("Label").getComponent(Label).string = str;
    }


    private close() {
        AE.playGeneralEffect('ToastOut', {
            offsetY: 100,
            node: this.node,
            callback: () => {
                this.node.destroy();
            }
        })
    }




}


